package woodnaonly.demoflinsh;

import android.os.Bundle;
import android.support.v7.app.AppCompatActivity;
import android.util.Log;

import com.google.gson.Gson;

import woodnaonly.demoflinsh.Bean.Bean;

public class GsonActivity extends AppCompatActivity {
    String json = "{\n" +
            "    \"error\": false,\n" +
            "    \"results\": [\n" +
            "        {\n" +
            "            \"who\": \"有时放纵\",\n" +
            "            \"publishedAt\": \"2016-02-02T03:57:06.976Z\",\n" +
            "            \"desc\": \"android 3D球形效果\",\n" +
            "            \"type\": \"Android\",\n" +
            "            \"url\": \"https://github.com/misakuo/3dTagCloudAndroid\",\n" +
            "            \"used\": true,\n" +
            "            \"objectId\": \"56af272da633bd0257cfd767\",\n" +
            "            \"createdAt\": \"2016-02-01T09:36:45.247Z\",\n" +
            "            \"updatedAt\": \"2016-02-02T03:57:07.780Z\"\n" +
            "        },\n" +
            "    ]\n" +
            "}";

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_gson);

        Gson gson = new Gson();
        Bean bean = gson.fromJson(json, Bean.class);
        Log.d("====", bean.results.get(0).linanyanglaji);
        Log.d("====", bean.results.get(0).desc);
        Log.d("====", bean.results.get(0).linanyanglaji2);
        Log.d("====", bean.results.get(0).linanyanglaji4 + "");
    }


}
